package com.itheima.object.homework.Test7;

/*7、【编号：707】 请定义一个描述矩形（MyRectangle）的类，包含宽和高两个属性，提供获取矩形周长（perimeter）和面积（area）的方法。
        并编写测试类进行测试。*/
public class MyRectangle {
    private int width;
    private int high;

    public MyRectangle() {
    }

    public MyRectangle(int width, int high) {
        this.width = width;
        this.high = high;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHigh() {
        return high;
    }

    public void setHigh(int high) {
        this.high = high;
    }

    public void show() {
        System.out.println(width + " " + high);
    }

    public int perimeter() {
        return width * 2 + high * 2;
    }

    public int area() {
        return width * high;
    }
}

class Test {
    public static void main(String[] args) {
        MyRectangle r = new MyRectangle(25, 10);
        System.out.println("矩形周长为: " + r.perimeter());
        System.out.println("矩形面积为: " + r.area());
    }
}